/**
 * 
 */
package name.yzhu.httpserver.method;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * http called method . and this method with annotation {@link HttpMethodAnno}
 * must need to be return a byte[] </br>
 * for example:
 * <pre>
 *   @HttpMethodAnno(hrm="login", parameter=user_name,password")
 *   byte[] login(string useName, String password)
 * </pre>
 * @author yhzhu
 *
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface HttpMethodAnno {
	/**
	 * if in http query , it has 
	 * hrm = abc
	 * Indicate this method is responsible for the get/post  query ,which contains 
	 * a parameter named hrm , the value is abc.
	 * <br>
	 * you can also set hrm equals to 'default', this means the http request does 
	 * not need contains hrm parameter
	 * 
	 * if hrm equals to "", the hrm be set as methodName.
	 * @return
	 */
	String hrm() default "";
	/**
	 * The parameters used for map the queries of 
	 * post/get method to the argument of handler method
	 * The comment of parameter should be follow empty space. 
	 * NOTE:<b>The comma does not allow appeared in comment</b>
	 * @return a string , separated by comma
	 */
	String parameters() default "";
	/**
	 * Declare an asynchorized method.
	 * @return
	 */
	boolean async() default false;
	/**
	 * naive means the parameters are httpServletRequest and httpServletResponse.
	 * @return
	 */
	boolean naive() default false;
	/**
	 * if the method need to check the permission, 
	 * we need to specify a class name which is a instance of {@link IMethodAuthorized}
	 * @return
	 */
	String authorized() default "";
	/**
	 * User defined error code.
	 * This code should be less than -10. 
	 * Multiply code should be separated by comma
	 * Every error code can go with a short comment. and separated by one or more empty spaces.
	 * Error codes
	 */
	String errorCode() default "";
	
	/**
	 * The returned content type from http server port.
	 * @return
	 */
	String contentType() default "text/plain";
}
